home *** CD-ROM | disk | FTP | other *** search
/ PC World 2008 April / PCWorld_2008-04_cd.bin / komercni software / miton / SystemMechanic7Pro.exe / {app} / smhtml.dll / 1033 / HTML / INTELLIINTERNETSPEEDBAR.JS < prev    next >
Text File  |  2008-01-24  |  5KB  |  132 lines

  1.  
  2. function IntelliInternetSpeedBarProperties()
  3. {
  4.   this.FullBarWidth = 0;
  5.   this.HilighterLeft = 0;
  6.   this.HilighterWidth = 50;
  7.   this.HilighterBackgroundImage = "ITS_speed_highlighter.gif";
  8.   this.HolderWidth = "48px";
  9.   this.HolderMarginLeft = "1px";
  10.   this.LowRange = "0";
  11.   this.HighRange = "128k";
  12.   
  13.   this.Get = __GetIntelliInternetSpeedBarProperties;
  14.   
  15.   function __GetIntelliInternetSpeedBarProperties(Range)
  16.   {
  17.     this.HilighterBackgroundImage = "ITS_speed_highlighter.gif";
  18.     this.HolderWidth = "48px";
  19.     this.HolderMarginLeft = "1px";
  20.     
  21.     switch(Range)
  22.     {
  23.       case "0":case 0:
  24.        this.FullBarWidth = 0;
  25.        this.HilighterLeft = 0;
  26.        this.HilighterBackgroundImage = "ITS_speed_highlighter_left.gif";
  27.        this.HilighterWidth = 60;
  28.        this.HolderWidth = "50px";
  29.        this.HolderMarginLeft = "10px";
  30.        this.LowRange = "0";
  31.        this.HighRange = "128k";
  32.        break;
  33.       case "1" : case 1:
  34.        this.FullBarWidth = 50;
  35.        this.HilighterLeft = 61;
  36.        this.LowRange = "128k";
  37.        this.HighRange = "384k";
  38.        break;
  39.       case "2" : case 2:
  40.        this.FullBarWidth = 100;
  41.        this.HilighterLeft = 110;
  42.        this.LowRange = "384k";
  43.        this.HighRange = "768k";
  44.        break;
  45.       case "3" : case 3:
  46.        this.FullBarWidth = 150;
  47.        this.HilighterLeft = 159;
  48.        this.LowRange = "768k";
  49.        this.HighRange = "1.5M";
  50.        break;
  51.       case "4" : case 4:
  52.        this.FullBarWidth = 200;
  53.        this.HilighterLeft = 208;
  54.        this.LowRange = "1.5M";
  55.        this.HighRange = "3M";
  56.        break;
  57.       case "5" : case 5:
  58.        this.FullBarWidth = 250;
  59.        this.HilighterLeft = 256;
  60.        this.HilighterBackgroundImage = "ITS_speed_highlighter_right.gif";
  61.        this.HilighterWidth = 57;
  62.        this.LowRange = "3M";
  63.        this.HighRange = "6M+";
  64.        break;
  65.     }
  66.   }
  67. }
  68.  
  69.  
  70. function IntelliInternetSpeedBar(id)
  71. {
  72.   this.ID =  id || "";
  73.   this.Progress = 100;
  74.   
  75.   this.Render = __IntelliInternetSpeedBarRender;
  76.   this.IsRendered = __IntelliInternetSpeedBarIsRendered;
  77.   this.SetRange = __IntelliInternetSpeedBarRange;
  78.   this.SetProgress = __IntelliInternetSpeedBarProgress;
  79.   
  80.   function __IntelliInternetSpeedBarIsRendered()
  81.   {
  82.    return  Get( "div_emptybar_" + this.ID  ) == null ? false : true;
  83.   }
  84.   
  85.   function __IntelliInternetSpeedBarRender()
  86.   {
  87.     var html = "";
  88.     
  89.     html +=  "<div id=\"div_emptybar_" + this.ID  + "\" style=\"background:url(ITS_speed_overallbar_empty.gif) no-repeat left top; position:absolute; left:10px; top:8px; z-index:1; width:296px; height:10px\"></div> ";
  90.     html +=  "<div id=\"div_fullbar_" + this.ID  + "\"  style=\"background:url(ITS_speed_overallbar_full.gif) no-repeat left top; position:absolute; left:11px; top:8px; z-index:2; width:50px; height:10px\">";
  91.     html +=  "</div>";
  92.     html +=  "<div  id=\"div_highlighter_" + this.ID  + "\"  style=\"background:url(ITS_speed_highlighter.gif) no-repeat left top; position:absolute; left:61px; top:0px; z-index:3; width:50px; height:22px\">";
  93.     
  94.     html +=  "<div  id=\"div_holder_" + this.ID  + "\"   style=\"width:48px; height:10px; margin-top:8px; margin-left:1px\">";
  95.     html +=  "<div  id=\"div_progress_" + this.ID  + "\"  style=\"float:left;height:8px; width: " + this.Progress + "%; background:url(ITS_speed_overallbar_full_highlighted.gif) right top repeat-x;\"></div>";
  96.     //html +=  "<div style=\"float:right; background:inherit; height:8px; width:57%;\"></div>";
  97.     
  98.     html +=  "</div>";
  99.     html +=  "</div>";
  100.     
  101.     return html;
  102.   }
  103.   
  104.   function __IntelliInternetSpeedBarRange(Range)
  105.   {
  106.       var p = null;
  107.       if( typeof(Range) == 'object' )
  108.         p = Range;
  109.       else
  110.       {
  111.         p = new IntelliInternetSpeedBarProperties();
  112.         p.Get(Range); 
  113.       }
  114.       
  115.       
  116.       Get("div_fullbar_" + this.ID ).style.width = p.FullBarWidth;
  117.       var divHighLighter = Get("div_highlighter_" + this.ID );
  118.       divHighLighter.style.left = p.HilighterLeft;
  119.       divHighLighter.style.width  = p.HilighterWidth;
  120.       divHighLighter.style.backgroundImage = "url('" + p.HilighterBackgroundImage + "')";
  121.       
  122.       var divHolder = Get("div_holder_" + this.ID );
  123.       divHolder.style.width = p.HolderWidth;
  124.       divHolder.style.marginLeft = p.HolderMarginLeft;
  125.   }
  126.   
  127.   function __IntelliInternetSpeedBarProgress(Progress)
  128.   {
  129.       Get("div_progress_" + this.ID ).style.width = Progress + "%";
  130.   }
  131. }
  132.